﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Spanner
{
    public partial class UI
    {
        /// <summary>
        /// Alert(msg) is equivalent to alert(msg) in JavaScript.
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static Act Alert(Expr<string> msg)
        {
            return JSAct("alert(#)", msg);
        }

        /// <summary>
        /// Confirm(msg) is equivalent to confirm(msg) in JavaScript.
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static Expr<bool> Confirm(Expr<string> msg)
        {
            return JSExpr<bool>("confirm(#)", msg);
        }

        /// <summary>
        /// Prompt(msg, value) is equivalent to prompt(msg, value) in JavaScript.
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static Expr<string> Prompt(Expr<string> msg, Expr<string> value = null)
        {
            return JSExpr<string>("prompt(#, #)", msg, value ?? "");
        }
    }
}
